package com.nanxhs.proxy.cglib;

import net.sf.cglib.proxy.InvocationHandler;

import java.lang.reflect.Method;

/**
 * cglib 代理接口
 * @author: haibin.tang
 * @date: 2021/2/5
 */
public class CgLibDynamicProxy implements InvocationHandler {

    private Object target;

    public CgLibDynamicProxy(Object target) {
        this.target = target;
    }

    public Object invoke(Object o, Method method, Object[] args) throws Throwable {
        System.out.println("调用开始" + target.getClass().getName() + "#" + method.getName());
        return method.invoke(target, args);
    }
}
